package com.mooc;

import net.bytebuddy.implementation.bind.annotation.*;

import java.lang.reflect.Method;
import java.util.concurrent.Callable;

public class UpdateArgumentInterceptor {
    @RuntimeType
    public static Object eat(@Origin Method method,
                             @Morph OverrideCallable callable,
                             @AllArguments Object[] objects){
        System.out.println("update argument before eat");
        objects[1] = "update apple";
        Object object = callable.call(objects);
        System.out.println("update argument after eat");
        return object;
    }
}
